package com.web3.management.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

/**
 * Tampermonkey 指令实体
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "tm_commands")
public class TmCommand extends BaseEntity {

    @Column(name = "client_id", nullable = false, length = 64)
    private String clientId;

    @Column(name = "account_id")
    private Integer accountId;

    @Column(name = "command_type", nullable = false, length = 64)
    private String commandType;

    @Lob
    @Column(name = "payload")
    private String payload;

    @Column(name = "status", nullable = false, length = 32)
    private String status = "PENDING";

    @Column(name = "sent_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date sentAt;

    @Column(name = "ack_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ackAt;

    @Column(name = "result_status", length = 32)
    private String resultStatus;

    @Column(name = "message", length = 255)
    private String message;

    @Lob
    @Column(name = "result_payload")
    private String resultPayload;
}
